<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="js/vue.js"></script>
		<script src="js/axios.min.js"></script>
		<title></title>
	</head>
	<body>
		<div id="app">
			<label>
				<input type="radio" name="sex" value="1" v-model="sexdefault" />男
			</label>
			<label>
				<input type="radio" name="sex" value="2" v-model="sexdefault" />女
			</label>
			<button @click="getsex()">获取选择的性别</button>
			
			<hr/>
			
			颜色:
			<label v-for="item in colorList">
				<input type="radio" name="color" :value="item.id" v-model="colordefault" />{{item.value}}
			</label><br/>
			选择的颜色ID：{{colordefault}}
			<button @click="getColor()">获取颜色</button>
			
		</div>
	</body>
	
	<script>
		new Vue({
			el: "#app",
			data: {
				sexdefault:1,
				colordefault:2,
				colorList: [
					{id:1, value:"赤"},
					{id:2, value:"橘"},
					{id:3, value:"金"},
					{id:4, value:"绿"},
					{id:5, value:"叶"},
					{id:6, value:"蓝"},
					{id:7, value:"贵"}
				]
			},
			methods: {
				getsex(){
					alert(this.sexdefault)
				},
				getColor(){
					alert(this.colordefault)
				}
			}
		})
	</script>
	
</html>